#! /usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use Pod::Usage; # use POD for Usage
use Win32::OLE;

my %options=(
os=>undef,
nsr_path=>undef,
perl_path=>undef,
win_public_path=>undef
);

my $wsh=new Win32::OLE 'WScript.Shell';
print "$^O\n";
#### Determination of OS ####  can take up to 1 Minute on windows os
if ($^O =~ /Win/){
	
	$options{os}="Win";
	$options{nsr_path}='C:/Legato/nsr';
	$options{win_public_path}='C:\Dokumente und Einstellungen\All Users\Desktop';
	$options{perl_path}=`dir /S /B C:\\Nagios | findstr "perl.exe"`;
	my $os=`systeminfo | findstr /B /C:"OS Name"`;
	if ($os =~ m/s*Server 2008.s*/){
		$options{win_public_path}='C:/Users/Public/Desktop';
	}
}else {
	$options{nsr_path}='/nsr';
}
if ($^O =~ /aix/){
	$options{os}="aix";
}else {
	$options{os}="linux";
}



# sub for creating links on windows systems
sub create_win_links{
	my $shcut_name=shift;
	my $full_file_path_name=shift;
	my $shcut=$wsh->CreateShortcut("$options{win_public_path}\\$shcut_name") or die;
	$shcut->{'TargetPath'}=$full_file_path_name;
	$shcut->Save;
}

create_win_links( "Notscript.lnk", "c:/Legato/nsr/res/Backup_DB_MAR.cmd");
